package com.snopy.designPattern.structure.adapter.impl;

import com.snopy.designPattern.structure.adapter.MediaAdapter;
import com.snopy.designPattern.structure.adapter.MediaPlayer;
import lombok.extern.slf4j.Slf4j;

/**
 * @author snopy
 * @version 1.0.0
 * @classname AudioPlayer
 * @description 装饰 适配 桥接 组合 享元 代理 门面
 * @email 77912204@qq.com
 * @date 2022/03/02 13:57
 */
@Slf4j
public class AudioPlayer implements MediaPlayer {
    MediaAdapter adapter;
    @Override
    public void play(String type,String file) {
        if (type.equalsIgnoreCase("MP3")){
            log.info("{} play {}}",type,file);
        }else if (type.equalsIgnoreCase("MP4")){
            adapter = new MediaAdapter(type);
            adapter.play(type,file);
        }else if (type.equalsIgnoreCase("VLC")){
            adapter = new MediaAdapter(type);
            adapter.play(type,file);
        }

    }
}
